/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.spring.context;

import javax.security.auth.login.Configuration;
import java.util.function.Predicate;

/**
 * 接口由类型实现，这些类型根据给定的选择条件(通常是一个或多个注释属性)确定应该导入哪些@{@link Configuration}类。
 *
 * <p>
 * {@link ImportSelector}可以实现以下任何一个{@link org.springframework.beans.factory.Aware Aware}接口，
 * 它们各自的方法将在{@link selectImports}之前被调用:
 * <ul>
 * <li>{@link org.springframework.context.EnvironmentAware EnvironmentAware}</li>
 * <li>{@link org.springframework.beans.factory.BeanFactoryAware BeanFactoryAware}</li>
 * <li>{@link org.springframework.beans.factory.BeanClassLoaderAware BeanClassLoaderAware}</li>
 * <li>{@link org.springframework.context.ResourceLoaderAware ResourceLoaderAware}</li>
 * </ul>
 *
 * <p>或者，类可以提供一个构造函数，其中包含一个或多个受支持的形参类型:
 * <ul>
 * <li>{@link org.springframework.core.env.Environment Environment}</li>
 * <li>{@link org.springframework.beans.factory.BeanFactory BeanFactory}</li>
 * <li>{@link ClassLoader ClassLoader}</li>
 * <li>{@link org.springframework.core.io.ResourceLoader ResourceLoader}</li>
 * </ul>
 *
 * <p>{@code ImportSelector}实现通常以与常规{@code @Import}注释相同的方式处理，然而，也可以推迟导入的选择，
 * 直到所有{@code @Configuration}类都处理完(参见{@link DeferredImportSelector}了解详细信息)。
 *
 * @author Chris Beams
 * @author Juergen Hoeller
 * @see DeferredImportSelector
 * @see Import
 * @see ImportBeanDefinitionRegistrar
 * @see Configuration
 * @since 3.1
 */
public interface ImportSelector {

    /**
     * 根据导入{@link Configuration}类的{@link AnnotationMetadata}选择并返回应该导入的类名。
     *
     * @return 类名，如果没有则为空数组
     */
//    String[] selectImports(AnnotationMetadata importingClassMetadata);

    /**
     * 返回一个谓词，用于从导入候选对象中排除类，该谓词将传递地应用于通过此选择器的导入找到的所有类。
     * <p>
     * 如果该谓词为给定的完全限定类名返回{@code true}，则该类将不会被视为导入的配置类，从而绕过类文件加载和元数据内省。
     *
     * @return 过滤器谓词用于传递导入的配置类的完全限定的候选类名，如果没有则为{@code null}
     *
     * @since 5.2.4
     */
    default Predicate<String> getExclusionFilter() {
        return null;
    }

}
